<template>
	<view class="">
		<u-sticky bgColor="#fff">
			<u-tabs :list="list1" @click="click"></u-tabs>
		</u-sticky>
		<view class="box">
			<view class="box_one" v-for="(item, index) in listrex" :key="index" @click="handleClick(item)">
				<image class="box_one_img" :src="item.coverUrl"></image>
				<view class="box_one_text">{{ item.noticeTitle }}</view>
			</view>

		</view>
	</view>

</template>

<script>
import { baseUrl } from '../../utils/config.js';

export default {
	data() {
		return {
			list1: [],
			name: "null",
			listrex: []
		}
	},
	onLoad() {
		this.getTip()
		this.getNVM(1)
	},
	methods: {
		click(item) {
			console.log('item', item);
			this.name = item.name
			this.getNVM(item.dictValue)
		},
		getTip() {
			var thas = this
			uni.request({
				url: `${baseUrl}/wechat/system/listType`,
				method: 'GET',
				
				success(res) {
					thas.list1 = res.data.data.map(item => {
						return {...item, name: item.dictLabel, index: item.dictValue,}
					})
				},

			});
		},
		getNVM(e) {
			var thas = this
			uni.request({
				url: `${baseUrl}/wechat/system/list`,
				method: 'GET',
				data: {
					noticeType: e
				},
				success(res) {
					console.log(res.data.data)
					thas.listrex = res.data.data.map(item => {
						return {
							...item,
							coverUrl: baseUrl + item.coverUrl
						}
					})
				},

			});
		},
		handleClick(row) {
			console.log(row,"111")
			uni.navigateTo({
				url: `/pages/news/add?id=${row.noticeId}`
			});
		},
	}
}
</script>

<style scoped lang="scss">
.box {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	flex-direction: row;
	padding: 10px;
	background-color: #f4f4f4;
	height: 100vh;
	overflow-y: auto;
	// overflow-x: hidden;

	.box_one {
		width: 49%;
		height: 270px;
		background-color: #fff;
		border-radius: 8px;
		margin-bottom: 10px;


		// box-shadow: 2px 3px 2px 4px #f4f4f4;
		.box_one_img {
			width: 100%;
			height: 80%;
			border-top-left-radius: 8px;
			border-top-right-radius: 8px;
		}

		.box_one_text {
			height: 20%;
			width: 100%;
			text-align: left;
			font-size: 12px;
			box-sizing: border-box;
			padding: 3px;
			display: -webkit-box;
			/* 设置为弹性盒子 */
			-webkit-box-orient: vertical;
			/* 设置为垂直方向 */
			overflow: hidden;
			/* 隐藏超出部分 */
			-webkit-line-clamp: 3;
			/* 设置显示的行数为3行 */
			color: #606266;
		}
	}
}
</style>